/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Generation.Production.impl;

import EA_Model.IEC61970.Core.impl.PowerSystemResourceImpl;

import EA_Model.IEC61970.Domain.ActivePower;
import EA_Model.IEC61970.Domain.RealEnergy;

import EA_Model.IEC61970.Generation.Production.CAESPlant;
import EA_Model.IEC61970.Generation.Production.ProductionPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>CAES Plant</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.CAESPlantImpl#getEnergyStorageCapacity <em>Energy Storage Capacity</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Generation.Production.impl.CAESPlantImpl#getRatedCapacityP <em>Rated Capacity P</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class CAESPlantImpl extends PowerSystemResourceImpl implements CAESPlant {
	/**
	 * The cached value of the '{@link #getEnergyStorageCapacity() <em>Energy Storage Capacity</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEnergyStorageCapacity()
	 * @generated
	 * @ordered
	 */
	protected RealEnergy energyStorageCapacity;

	/**
	 * The cached value of the '{@link #getRatedCapacityP() <em>Rated Capacity P</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRatedCapacityP()
	 * @generated
	 * @ordered
	 */
	protected ActivePower ratedCapacityP;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected CAESPlantImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ProductionPackage.Literals.CAES_PLANT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RealEnergy getEnergyStorageCapacity() {
		if (energyStorageCapacity != null && energyStorageCapacity.eIsProxy()) {
			InternalEObject oldEnergyStorageCapacity = (InternalEObject)energyStorageCapacity;
			energyStorageCapacity = (RealEnergy)eResolveProxy(oldEnergyStorageCapacity);
			if (energyStorageCapacity != oldEnergyStorageCapacity) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.CAES_PLANT__ENERGY_STORAGE_CAPACITY, oldEnergyStorageCapacity, energyStorageCapacity));
			}
		}
		return energyStorageCapacity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RealEnergy basicGetEnergyStorageCapacity() {
		return energyStorageCapacity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEnergyStorageCapacity(RealEnergy newEnergyStorageCapacity) {
		RealEnergy oldEnergyStorageCapacity = energyStorageCapacity;
		energyStorageCapacity = newEnergyStorageCapacity;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.CAES_PLANT__ENERGY_STORAGE_CAPACITY, oldEnergyStorageCapacity, energyStorageCapacity));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower getRatedCapacityP() {
		if (ratedCapacityP != null && ratedCapacityP.eIsProxy()) {
			InternalEObject oldRatedCapacityP = (InternalEObject)ratedCapacityP;
			ratedCapacityP = (ActivePower)eResolveProxy(oldRatedCapacityP);
			if (ratedCapacityP != oldRatedCapacityP) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProductionPackage.CAES_PLANT__RATED_CAPACITY_P, oldRatedCapacityP, ratedCapacityP));
			}
		}
		return ratedCapacityP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActivePower basicGetRatedCapacityP() {
		return ratedCapacityP;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRatedCapacityP(ActivePower newRatedCapacityP) {
		ActivePower oldRatedCapacityP = ratedCapacityP;
		ratedCapacityP = newRatedCapacityP;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ProductionPackage.CAES_PLANT__RATED_CAPACITY_P, oldRatedCapacityP, ratedCapacityP));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ProductionPackage.CAES_PLANT__ENERGY_STORAGE_CAPACITY:
				if (resolve) return getEnergyStorageCapacity();
				return basicGetEnergyStorageCapacity();
			case ProductionPackage.CAES_PLANT__RATED_CAPACITY_P:
				if (resolve) return getRatedCapacityP();
				return basicGetRatedCapacityP();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ProductionPackage.CAES_PLANT__ENERGY_STORAGE_CAPACITY:
				setEnergyStorageCapacity((RealEnergy)newValue);
				return;
			case ProductionPackage.CAES_PLANT__RATED_CAPACITY_P:
				setRatedCapacityP((ActivePower)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ProductionPackage.CAES_PLANT__ENERGY_STORAGE_CAPACITY:
				setEnergyStorageCapacity((RealEnergy)null);
				return;
			case ProductionPackage.CAES_PLANT__RATED_CAPACITY_P:
				setRatedCapacityP((ActivePower)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ProductionPackage.CAES_PLANT__ENERGY_STORAGE_CAPACITY:
				return energyStorageCapacity != null;
			case ProductionPackage.CAES_PLANT__RATED_CAPACITY_P:
				return ratedCapacityP != null;
		}
		return super.eIsSet(featureID);
	}

} //CAESPlantImpl
